package com.ruoyi.appuser.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.appuser.domain.Appuser;
import com.ruoyi.appuser.domain.vo.AppuserVO;
import com.ruoyi.appuser.mapper.AppuserMapper;
import com.ruoyi.appuser.service.IAppuserService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 用户Service业务层处理
 *
 * @author ruoyi
 * @date 2024-01-14
 */
@Service
public class AppuserServiceImpl extends ServiceImpl<AppuserMapper, Appuser> implements IAppuserService
{
    @Resource
    private AppuserMapper appuserMapper;

    /**
     * 查询用户
     *
     * @param id 用户主键
     * @return 用户
     */
    @Override
    public Appuser selectAppuserById(String id)
    {
        return appuserMapper.selectAppuserById(id);
    }

    /**
     * 查询用户列表
     *
     * @param appuser 用户
     * @return 用户
     */
    @Override
    public List<Appuser> selectAppuserList(Appuser appuser)
    {
        return appuserMapper.selectAppuserList(appuser);
    }

    /**
     * 新增用户
     *
     * @param appuser 用户
     * @return 结果
     */
    @Override
    public int insertAppuser(Appuser appuser)
    {
        appuser.setCreateTime(DateUtils.getNowDate());
        return appuserMapper.insertAppuser(appuser);
    }

    /**
     * 修改用户
     *
     * @param appuser 用户
     * @return 结果
     */
    @Override
    public int updateAppuser(Appuser appuser)
    {
        appuser.setUpdateTime(DateUtils.getNowDate());
        return appuserMapper.updateAppuser(appuser);
    }

    /**
     * 批量删除用户
     *
     * @param ids 需要删除的用户主键
     * @return 结果
     */
    @Override
    public int deleteAppuserByIds(String[] ids)
    {
        return appuserMapper.deleteAppuserByIds(ids);
    }

    /**
     * 删除用户信息
     *
     * @param id 用户主键
     * @return 结果
     */
    @Override
    public int deleteAppuserById(String id)
    {
        return appuserMapper.deleteAppuserById(id);
    }

    /**mjl
     * @param loginUserId
     * @return
     */
    @Override
    public AppuserVO getUserInfo(String loginUserId) {
        return baseMapper.getUserInfo(loginUserId);
    }
}
